home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / What's New? / Development Kits / ColorSync™ 2.0.1 GM / Interfaces / CIncludes / CMApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-12  |  28.1 KB  |  770 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CMApplication.h
  3.  
  4.      Contains:    Color Matching Interfaces
  5.  
  6.      Version:    Technology:    ColorSync 2.0
  7.                  Release:    2.0f3
  8.  
  9.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, send the file and version
  13.                  information (from above) and the problem description to:
  14.  
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __CMAPPLICATION__
  21. #define __CMAPPLICATION__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __QUICKDRAW__
  30. #include <Quickdraw.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <QuickdrawText.h>                                    */
  34. /*        #include <ScriptLayout.h>                                */
  35.  
  36. #ifndef __FILES__
  37. #include <Files.h>
  38. #endif
  39. /*    #include <OSUtils.h>                                        */
  40. /*        #include <Memory.h>                                        */
  41. /*    #include <Finder.h>                                            */
  42.  
  43. #ifndef __PRINTING__
  44. #include <Printing.h>
  45. #endif
  46. /*    #include <Errors.h>                                            */
  47. /*    #include <Dialogs.h>                                        */
  48. /*        #include <Windows.h>                                    */
  49. /*            #include <Events.h>                                    */
  50. /*            #include <Controls.h>                                */
  51. /*                #include <Collections.h>                        */
  52. /*                #include <Appearance.h>                            */
  53. /*                #include <TextObjects.h>                        */
  54. /*                    #include <Unicode.h>                        */
  55. /*                #include <Menus.h>                                */
  56. /*            #include <AppleEvents.h>                            */
  57. /*                #include <EPPC.h>                                */
  58. /*                    #include <AppleTalk.h>                        */
  59. /*                    #include <PPCToolbox.h>                        */
  60. /*                    #include <Processes.h>                        */
  61. /*                #include <Notification.h>                        */
  62. /*                    #include <Kernel.h>                            */
  63. /*                        #include <MachineExceptions.h>            */
  64. /*                        #include <Timing.h>                        */
  65. /*            #include <Drag.h>                                    */
  66. /*                #include <TextEdit.h>                            */
  67.  
  68. #ifndef __CMICCPROFILE__
  69. #include <CMICCProfile.h>
  70. #endif
  71.  
  72. #ifdef __cplusplus
  73. extern "C" {
  74. #endif
  75.  
  76. #if GENERATINGPOWERPC
  77. #pragma options align=mac68k
  78. #endif
  79.  
  80. #ifdef __CFM68K__
  81. #pragma import on
  82. #endif
  83.  
  84.  
  85. enum {
  86.     gestaltColorSync20            = 0x0200
  87. };
  88.  
  89. enum {
  90.     kDefaultCMMSignature        = 'appl'
  91. };
  92.  
  93. /* Macintosh 68K trap word */
  94. enum {
  95.     cmTrap                        = 0xABEE
  96. };
  97.  
  98. /* PicComment IDs */
  99. enum {
  100.     cmBeginProfile                = 220,
  101.     cmEndProfile                = 221,
  102.     cmEnableMatching            = 222,
  103.     cmDisableMatching            = 223,
  104.     cmComment                    = 224
  105. };
  106.  
  107. /* PicComment selectors for cmComment */
  108. enum {
  109.     cmBeginProfileSel            = 0,
  110.     cmContinueProfileSel        = 1,
  111.     cmEndProfileSel                = 2
  112. };
  113.  
  114. /* Defines for version 1.0 CMProfileSearchRecord.fieldMask */
  115. enum {
  116.     cmMatchCMMType                = 0x00000001,
  117.     cmMatchApplProfileVersion    = 0x00000002,
  118.     cmMatchDataType                = 0x00000004,
  119.     cmMatchDeviceType            = 0x00000008,
  120.     cmMatchDeviceManufacturer    = 0x00000010,
  121.     cmMatchDeviceModel            = 0x00000020,
  122.     cmMatchDeviceAttributes        = 0x00000040,
  123.     cmMatchFlags                = 0x00000080,
  124.     cmMatchOptions                = 0x00000100,
  125.     cmMatchWhite                = 0x00000200,
  126.     cmMatchBlack                = 0x00000400
  127. };
  128.  
  129. /* Defines for version 2.0 CMSearchRecord.searchMask */
  130. enum {
  131.     cmMatchAnyProfile            = 0x00000000,
  132.     cmMatchProfileCMMType        = 0x00000001,
  133.     cmMatchProfileClass            = 0x00000002,
  134.     cmMatchDataColorSpace        = 0x00000004,
  135.     cmMatchProfileConnectionSpace = 0x00000008,
  136.     cmMatchManufacturer            = 0x00000010,
  137.     cmMatchModel                = 0x00000020,
  138.     cmMatchAttributes            = 0x00000040,
  139.     cmMatchProfileFlags            = 0x00000080
  140. };
  141.  
  142. /* Result codes */
  143. enum {
  144. /* General Errors */
  145.     cmProfileError                = -170,
  146.     cmMethodError                = -171,
  147.     cmMethodNotFound            = -175,                            /* CMM not present */
  148.     cmProfileNotFound            = -176,                            /* Responder error */
  149.     cmProfilesIdentical            = -177,                            /* Profiles the same */
  150.     cmCantConcatenateError        = -178,                            /* Profile can't be concatenated */
  151.     cmCantXYZ                    = -179,                            /* CMM cant handle XYZ space */
  152.     cmCantDeleteProfile            = -180,                            /* Responder error */
  153.     cmUnsupportedDataType        = -181,                            /* Responder error */
  154.     cmNoCurrentProfile            = -182,                            /* Responder error */
  155. /* Profile Access Errors */
  156.     cmElementTagNotFound        = -4200,
  157.     cmIndexRangeErr                = -4201,                        /* Index out of range */
  158.     cmCantDeleteElement            = -4202,
  159.     cmFatalProfileErr            = -4203,
  160.     cmInvalidProfile            = -4204,                        /* A Profile must contain a 'cs1 ' tag to be valid */
  161.     cmInvalidProfileLocation    = -4205,                        /* Operation not supported for this profile location */
  162. /* Profile Search Errors */
  163.     cmInvalidSearch                = -4206,                        /* Bad Search Handle */
  164.     cmSearchError                = -4207,
  165.     cmErrIncompatibleProfile    = -4208,
  166. /* Other ColorSync Errors */
  167.     cmInvalidColorSpace            = -4209,                        /* Profile colorspace does not match bitmap type */
  168.     cmInvalidSrcMap                = -4210,                        /* Source pix/bit map was invalid */
  169.     cmInvalidDstMap                = -4211,                        /* Destination pix/bit map was invalid */
  170.     cmNoGDevicesError            = -4212,                        /* Begin/End Matching -- no gdevices available */
  171.     cmInvalidProfileComment        = -4213,                        /* Bad Profile comment during drawpicture */
  172. /* Color Conversion Errors */
  173.     cmRangeOverFlow                = -4214,                        /* One or more output color value overflows in color conversion 
  174.                                                         all input color values will still be converted, and the overflown 
  175.                                                         will be clipped */
  176. /* Other Profile Access Errors */
  177.     cmCantCopyModifiedV1Profile    = -4215                            /* It is illegal to copy version 1 profiles that  
  178.                                                         have been modified */
  179. };
  180.  
  181. /* deviceType values for ColorSync 1.0 Device Profile access */
  182. enum {
  183.     cmSystemDevice                = 'sys ',
  184.     cmGDevice                    = 'gdev'
  185. };
  186.  
  187. /* Commands for CMFlattenUPP(…) */
  188. enum {
  189.     cmOpenReadSpool                = 1,
  190.     cmOpenWriteSpool,
  191.     cmReadSpool,
  192.     cmWriteSpool,
  193.     cmCloseSpool
  194. };
  195.  
  196. /* Flags for PostScript-related functions */
  197. enum {
  198.     cmPS7bit                    = 1,
  199.     cmPS8bit                    = 2
  200. };
  201.  
  202. typedef struct CMPrivateProfileRecord *CMProfileRef;
  203.  
  204. /* Abstract data type for Profile search result */
  205. typedef struct CMPrivateProfileSearchResult *CMProfileSearchRef;
  206.  
  207. /* Abstract data type for BeginMatching(…) reference */
  208. typedef struct CMPrivateMatchRefRecord *CMMatchRef;
  209.  
  210. /* Abstract data type for ColorWorld reference */
  211. typedef struct CMPrivateColorWorldRecord *CMWorldRef;
  212.  
  213. /* Caller-supplied progress function for Bitmap & PixMap matching routines */
  214. /* Caller-supplied filter function for Profile search */
  215. typedef pascal OSErr (*CMFlattenProcPtr)(long command, long *size, void *data, void *refCon);
  216. typedef pascal Boolean (*CMBitmapCallBackProcPtr)(long progress, void *refCon);
  217. typedef pascal Boolean (*CMProfileFilterProcPtr)(CMProfileRef prof, void *refCon);
  218.  
  219. #if GENERATINGCFM
  220. typedef UniversalProcPtr CMFlattenUPP;
  221. typedef UniversalProcPtr CMBitmapCallBackUPP;
  222. typedef UniversalProcPtr CMProfileFilterUPP;
  223. #else
  224. typedef CMFlattenProcPtr CMFlattenUPP;
  225. typedef CMBitmapCallBackProcPtr CMBitmapCallBackUPP;
  226. typedef CMProfileFilterProcPtr CMProfileFilterUPP;
  227. #endif
  228.  
  229. enum {
  230.     uppCMFlattenProcInfo = kPascalStackBased
  231.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  232.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  233.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
  234.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void*)))
  235.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))),
  236.     uppCMBitmapCallBackProcInfo = kPascalStackBased
  237.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  238.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  239.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*))),
  240.     uppCMProfileFilterProcInfo = kPascalStackBased
  241.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  242.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CMProfileRef)))
  243.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  244. };
  245.  
  246. #if GENERATINGCFM
  247. #define NewCMFlattenProc(userRoutine)        \
  248.         (CMFlattenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMFlattenProcInfo, GetCurrentArchitecture())
  249. #define NewCMBitmapCallBackProc(userRoutine)        \
  250.         (CMBitmapCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, GetCurrentArchitecture())
  251. #define NewCMProfileFilterProc(userRoutine)        \
  252.         (CMProfileFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileFilterProcInfo, GetCurrentArchitecture())
  253. #else
  254. #define NewCMFlattenProc(userRoutine)        \
  255.         ((CMFlattenUPP) (userRoutine))
  256. #define NewCMBitmapCallBackProc(userRoutine)        \
  257.         ((CMBitmapCallBackUPP) (userRoutine))
  258. #define NewCMProfileFilterProc(userRoutine)        \
  259.         ((CMProfileFilterUPP) (userRoutine))
  260. #endif
  261.  
  262. #if GENERATINGCFM
  263. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  264.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMFlattenProcInfo, (command), (size), (data), (refCon))
  265. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  266.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, (progress), (refCon))
  267. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  268.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCMProfileFilterProcInfo, (prof), (refCon))
  269. #else
  270. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)        \
  271.         (*(userRoutine))((command), (size), (data), (refCon))
  272. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)        \
  273.         (*(userRoutine))((progress), (refCon))
  274. #define CallCMProfileFilterProc(userRoutine, prof, refCon)        \
  275.         (*(userRoutine))((prof), (refCon))
  276. #endif
  277.  
  278. typedef long CMError;
  279.  
  280. /* For 1.0 and 2.0 profile header variants */
  281. /* CMAppleProfileHeader */
  282. union CMAppleProfileHeader {
  283.     CMHeader                        cm1;
  284.     CM2Header                        cm2;
  285. };
  286. typedef union CMAppleProfileHeader CMAppleProfileHeader;
  287.  
  288. /* Param for CWConcatColorWorld(…) */
  289. struct CMConcatProfileSet {
  290.     unsigned short                    keyIndex;                    /* Zero-based */
  291.     unsigned short                    count;                        /* Min 1 */
  292.     CMProfileRef                    profileSet[1];                /* Variable. Ordered from Source -> Dest */
  293. };
  294. typedef struct CMConcatProfileSet CMConcatProfileSet;
  295.  
  296. /* ColorSync color data types */
  297. struct CMRGBColor {
  298.     unsigned short                    red;                        /* 0..65535 */
  299.     unsigned short                    green;
  300.     unsigned short                    blue;
  301. };
  302. typedef struct CMRGBColor CMRGBColor;
  303.  
  304. struct CMCMYKColor {
  305.     unsigned short                    cyan;                        /* 0..65535 */
  306.     unsigned short                    magenta;
  307.     unsigned short                    yellow;
  308.     unsigned short                    black;
  309. };
  310. typedef struct CMCMYKColor CMCMYKColor;
  311.  
  312. struct CMCMYColor {
  313.     unsigned short                    cyan;                        /* 0..65535 */
  314.     unsigned short                    magenta;
  315.     unsigned short                    yellow;
  316. };
  317. typedef struct CMCMYColor CMCMYColor;
  318.  
  319. struct CMHLSColor {
  320.     unsigned short                    hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  321.     unsigned short                    lightness;                    /* 0..65535 */
  322.     unsigned short                    saturation;                    /* 0..65535 */
  323. };
  324. typedef struct CMHLSColor CMHLSColor;
  325.  
  326. struct CMHSVColor {
  327.     unsigned short                    hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  328.     unsigned short                    saturation;                    /* 0..65535 */
  329.     unsigned short                    value;                        /* 0..65535 */
  330. };
  331. typedef struct CMHSVColor CMHSVColor;
  332.  
  333. struct CMLabColor {
  334.     unsigned short                    L;                            /* 0..65535 maps to 0..100 */
  335.     unsigned short                    a;                            /* 0..65535 maps to -128..127.996 */
  336.     unsigned short                    b;                            /* 0..65535 maps to -128..127.996 */
  337. };
  338. typedef struct CMLabColor CMLabColor;
  339.  
  340. struct CMLuvColor {
  341.     unsigned short                    L;                            /* 0..65535 maps to 0..100 */
  342.     unsigned short                    u;                            /* 0..65535 maps to -128..127.996 */
  343.     unsigned short                    v;                            /* 0..65535 maps to -128..127.996 */
  344. };
  345. typedef struct CMLuvColor CMLuvColor;
  346.  
  347. struct CMYxyColor {
  348.     unsigned short                    capY;                        /* 0..65535 maps to 0..1 */
  349.     unsigned short                    x;                            /* 0..65535 maps to 0..1 */
  350.     unsigned short                    y;                            /* 0..65535 maps to 0..1 */
  351. };
  352. typedef struct CMYxyColor CMYxyColor;
  353.  
  354. struct CMGrayColor {
  355.     unsigned short                    gray;                        /* 0..65535 */
  356. };
  357. typedef struct CMGrayColor CMGrayColor;
  358.  
  359. struct CMMultichannel5Color {
  360.     unsigned char                    components[5];                /* 0..255 */
  361. };
  362. typedef struct CMMultichannel5Color CMMultichannel5Color;
  363.  
  364. struct CMMultichannel6Color {
  365.     unsigned char                    components[6];                /* 0..255 */
  366. };
  367. typedef struct CMMultichannel6Color CMMultichannel6Color;
  368.  
  369. struct CMMultichannel7Color {
  370.     unsigned char                    components[7];                /* 0..255 */
  371. };
  372. typedef struct CMMultichannel7Color CMMultichannel7Color;
  373.  
  374. struct CMMultichannel8Color {
  375.     unsigned char                    components[8];                /* 0..255 */
  376. };
  377. typedef struct CMMultichannel8Color CMMultichannel8Color;
  378.  
  379. union CMColor {
  380.     CMRGBColor                        rgb;
  381.     CMHSVColor                        hsv;
  382.     CMHLSColor                        hls;
  383.     CMXYZColor                        XYZ;
  384.     CMLabColor                        Lab;
  385.     CMLuvColor                        Luv;
  386.     CMYxyColor                        Yxy;
  387.     CMCMYKColor                        cmyk;
  388.     CMCMYColor                        cmy;
  389.     CMGrayColor                        gray;
  390.     CMMultichannel5Color            mc5;
  391.     CMMultichannel6Color            mc6;
  392.     CMMultichannel7Color            mc7;
  393.     CMMultichannel8Color            mc8;
  394. };
  395. typedef union CMColor CMColor;
  396.  
  397. struct CMProfileSearchRecord {
  398.     CMHeader                        header;
  399.     unsigned long                    fieldMask;
  400.     unsigned long                    reserved[2];
  401. };
  402. typedef struct CMProfileSearchRecord CMProfileSearchRecord, **CMProfileSearchRecordHandle;
  403.  
  404. /* Search definition for 2.0 */
  405. struct CMSearchRecord {
  406.     OSType                            CMMType;
  407.     OSType                            profileClass;
  408.     OSType                            dataColorSpace;
  409.     OSType                            profileConnectionSpace;
  410.     unsigned long                    deviceManufacturer;
  411.     unsigned long                    deviceModel;
  412.     unsigned long                    deviceAttributes[2];
  413.     unsigned long                    profileFlags;
  414.     unsigned long                    searchMask;
  415.     CMProfileFilterUPP                filter;
  416. };
  417. typedef struct CMSearchRecord CMSearchRecord;
  418.  
  419. /* GetCWInfo structures */
  420. struct CMMInfoRecord {
  421.     OSType                            CMMType;
  422.     long                            CMMVersion;
  423. };
  424. typedef struct CMMInfoRecord CMMInfoRecord;
  425.  
  426. struct CMCWInfoRecord {
  427.     unsigned long                    cmmCount;
  428.     CMMInfoRecord                    cmmInfo[2];
  429. };
  430. typedef struct CMCWInfoRecord CMCWInfoRecord;
  431.  
  432.  
  433. enum {
  434.     cmNoColorPacking            = 0x0000,
  435.     cmAlphaSpace                = 0x0080,
  436.     cmWord5ColorPacking            = 0x0500,
  437.     cmLong8ColorPacking            = 0x0800,
  438.     cmLong10ColorPacking        = 0x0a00,
  439.     cmAlphaFirstPacking            = 0x1000,
  440.     cmOneBitDirectPacking        = 0x0b00
  441. };
  442.  
  443. enum {
  444.     cmNoSpace                    = 0,
  445.     cmRGBSpace,
  446.     cmCMYKSpace,
  447.     cmHSVSpace,
  448.     cmHLSSpace,
  449.     cmYXYSpace,
  450.     cmXYZSpace,
  451.     cmLUVSpace,
  452.     cmLABSpace,
  453.     cmReservedSpace1,
  454.     cmGraySpace,
  455.     cmReservedSpace2,
  456.     cmGamutResultSpace,
  457.     cmRGBASpace                    = cmRGBSpace + cmAlphaSpace,
  458.     cmGrayASpace                = cmGraySpace + cmAlphaSpace,
  459.     cmRGB16Space                = cmWord5ColorPacking + cmRGBSpace,
  460.     cmRGB32Space                = cmLong8ColorPacking + cmRGBSpace,
  461.     cmARGB32Space                = cmLong8ColorPacking + cmAlphaFirstPacking + cmRGBASpace,
  462.     cmCMYK32Space                = cmLong8ColorPacking + cmCMYKSpace,
  463.     cmHSV32Space                = cmLong10ColorPacking + cmHSVSpace,
  464.     cmHLS32Space                = cmLong10ColorPacking + cmHLSSpace,
  465.     cmYXY32Space                = cmLong10ColorPacking + cmYXYSpace,
  466.     cmXYZ32Space                = cmLong10ColorPacking + cmXYZSpace,
  467.     cmLUV32Space                = cmLong10ColorPacking + cmLUVSpace,
  468.     cmLAB32Space                = cmLong10ColorPacking + cmLABSpace,
  469.     cmGamutResult1Space            = cmOneBitDirectPacking + cmGamutResultSpace
  470. };
  471.  
  472. typedef unsigned long CMBitmapColorSpace;
  473.  
  474. struct CMBitmap {
  475.     char                            *image;
  476.     long                            width;
  477.     long                            height;
  478.     long                            rowBytes;
  479.     long                            pixelSize;
  480.     CMBitmapColorSpace                space;
  481.     long                            user1;
  482.     long                            user2;
  483. };
  484. typedef struct CMBitmap CMBitmap;
  485.  
  486. /* Classic Print Manager Stuff */
  487.  
  488. enum {
  489.     enableColorMatchingOp        = 12,
  490.     registerProfileOp            = 13
  491. };
  492.  
  493. /* PrGeneral parameter blocks */
  494. struct TEnableColorMatchingBlk {
  495.     short                            iOpCode;
  496.     short                            iError;
  497.     long                            lReserved;
  498.     THPrint                            hPrint;
  499.     Boolean                            fEnableIt;
  500.     SInt8                            filler;
  501. };
  502. typedef struct TEnableColorMatchingBlk TEnableColorMatchingBlk;
  503.  
  504. struct TRegisterProfileBlk {
  505.     short                            iOpCode;
  506.     short                            iError;
  507.     long                            lReserved;
  508.     THPrint                            hPrint;
  509.     Boolean                            fRegisterIt;
  510.     SInt8                            filler;
  511. };
  512. typedef struct TRegisterProfileBlk TRegisterProfileBlk;
  513.  
  514.  
  515. enum {
  516.     cmNoProfileBase                = 0,
  517.     cmFileBasedProfile            = 1,
  518.     cmHandleBasedProfile        = 2,
  519.     cmPtrBasedProfile            = 3
  520. };
  521.  
  522. struct CMFileLocation {
  523.     FSSpec                            spec;
  524. };
  525. typedef struct CMFileLocation CMFileLocation;
  526.  
  527. struct CMHandleLocation {
  528.     Handle                            h;
  529. };
  530. typedef struct CMHandleLocation CMHandleLocation;
  531.  
  532. struct CMPtrLocation {
  533.     Ptr                                p;
  534. };
  535. typedef struct CMPtrLocation CMPtrLocation;
  536.  
  537. union CMProfLoc {
  538.     CMFileLocation                    fileLoc;
  539.     CMHandleLocation                handleLoc;
  540.     CMPtrLocation                    ptrLoc;
  541. };
  542. typedef union CMProfLoc CMProfLoc;
  543.  
  544. struct CMProfileLocation {
  545.     short                            locType;
  546.     CMProfLoc                        u;
  547. };
  548. typedef struct CMProfileLocation CMProfileLocation;
  549.  
  550. /* Profile file and element access */
  551. extern pascal CMError CMOpenProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  552.  FOURWORDINLINE(0x203C, 0x0008, 0x001C, 0xABEE);
  553. extern pascal CMError CMCloseProfile(CMProfileRef prof)
  554.  FOURWORDINLINE(0x203C, 0x0004, 0x001D, 0xABEE);
  555. extern pascal CMError CMUpdateProfile(CMProfileRef prof)
  556.  FOURWORDINLINE(0x203C, 0x0004, 0x0034, 0xABEE);
  557. extern pascal CMError CMNewProfile(CMProfileRef *prof, const CMProfileLocation *theProfile)
  558.  FOURWORDINLINE(0x203C, 0x0008, 0x001B, 0xABEE);
  559. extern pascal CMError CMCopyProfile(CMProfileRef *targetProf, const CMProfileLocation *targetLocation, CMProfileRef srcProf)
  560.  FOURWORDINLINE(0x203C, 0x000C, 0x0025, 0x0ABEE);
  561. extern pascal CMError CMGetProfileLocation(CMProfileRef prof, CMProfileLocation *theProfile)
  562.  FOURWORDINLINE(0x203C, 0x0008, 0x003C, 0x0ABEE);
  563. extern pascal CMError CMValidateProfile(CMProfileRef prof, Boolean *valid, Boolean *preferredCMMnotfound)
  564.  FOURWORDINLINE(0x203C, 0x000C, 0x0026, 0x0ABEE);
  565. extern pascal CMError CMFlattenProfile(CMProfileRef prof, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  566.  FOURWORDINLINE(0x203C, 0x0014, 0x0031, 0x0ABEE);
  567. extern pascal CMError CMUnflattenProfile(FSSpec *resultFileSpec, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  568.  FOURWORDINLINE(0x203C, 0x0010, 0x0032, 0x0ABEE);
  569. extern pascal CMError CMProfileElementExists(CMProfileRef prof, OSType tag, Boolean *found)
  570.  FOURWORDINLINE(0x203C, 0x000C, 0x001E, 0x0ABEE);
  571. extern pascal CMError CMCountProfileElements(CMProfileRef prof, unsigned long *elementCount)
  572.  FOURWORDINLINE(0x203C, 0x0008, 0x001F, 0x0ABEE);
  573. extern pascal CMError CMGetProfileElement(CMProfileRef prof, OSType tag, unsigned long *elementSize, void *elementData)
  574.  FOURWORDINLINE(0x203C, 0x0010, 0x0020, 0x0ABEE);
  575. extern pascal CMError CMGetProfileHeader(CMProfileRef prof, CMAppleProfileHeader *header)
  576.  FOURWORDINLINE(0x203C, 0x0008, 0x0039, 0x0ABEE);
  577. extern pascal CMError CMGetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long *byteCount, void *elementData)
  578.  FOURWORDINLINE(0x203C, 0x0014, 0x0036, 0x0ABEE);
  579. extern pascal CMError CMSetProfileElementSize(CMProfileRef prof, OSType tag, unsigned long elementSize)
  580.  FOURWORDINLINE(0x203C, 0x000C, 0x0038, 0x0ABEE);
  581. extern pascal CMError CMSetPartialProfileElement(CMProfileRef prof, OSType tag, unsigned long offset, unsigned long byteCount, void *elementData)
  582.  FOURWORDINLINE(0x203C, 0x0014, 0x0037, 0x0ABEE);
  583. extern pascal CMError CMGetIndProfileElementInfo(CMProfileRef prof, unsigned long index, OSType *tag, unsigned long *elementSize, Boolean *refs)
  584.  FOURWORDINLINE(0x203C, 0x0014, 0x0021, 0x0ABEE);
  585. extern pascal CMError CMGetIndProfileElement(CMProfileRef prof, unsigned long index, unsigned long *elementSize, void *elementData)
  586.  FOURWORDINLINE(0x203C, 0x0010, 0x0022, 0x0ABEE);
  587. extern pascal CMError CMSetProfileElement(CMProfileRef prof, OSType tag, unsigned long elementSize, void *elementData)
  588.  FOURWORDINLINE(0x203C, 0x0010, 0x0023, 0x0ABEE);
  589. extern pascal CMError CMSetProfileHeader(CMProfileRef prof, const CMAppleProfileHeader *header)
  590.  FOURWORDINLINE(0x203C, 0x0008, 0x003A, 0x0ABEE);
  591. extern pascal CMError CMSetProfileElementReference(CMProfileRef prof, OSType elementTag, OSType referenceTag)
  592.  FOURWORDINLINE(0x203C, 0x000C, 0x0035, 0x0ABEE);
  593. extern pascal CMError CMRemoveProfileElement(CMProfileRef prof, OSType tag)
  594.  FOURWORDINLINE(0x203C, 0x0008, 0x0024, 0x0ABEE);
  595. extern pascal CMError CMGetScriptProfileDescription(CMProfileRef prof, Str255 name, ScriptCode *code)
  596.  FOURWORDINLINE(0x203C, 0x000C, 0x003E, 0x0ABEE);
  597. /* Low-level matching functions */
  598. extern pascal CMError NCWNewColorWorld(CMWorldRef *cw, CMProfileRef src, CMProfileRef dst)
  599.  FOURWORDINLINE(0x203C, 0x000C, 0x0014, 0x0ABEE);
  600. extern pascal CMError CWConcatColorWorld(CMWorldRef *cw, CMConcatProfileSet *profileSet)
  601.  FOURWORDINLINE(0x203C, 0x0008, 0x0015, 0x0ABEE);
  602. extern pascal CMError CWNewLinkProfile(CMProfileRef *prof, const CMProfileLocation *targetLocation, CMConcatProfileSet *profileSet)
  603.  FOURWORDINLINE(0x203C, 0x000C, 0x0033, 0x0ABEE);
  604. extern pascal void CWDisposeColorWorld(CMWorldRef cw)
  605.  FOURWORDINLINE(0x203C, 0x0004, 0x0001, 0x0ABEE);
  606. extern pascal CMError CWMatchColors(CMWorldRef cw, CMColor *myColors, unsigned long count)
  607.  FOURWORDINLINE(0x203C, 0x000C, 0x0002, 0x0ABEE);
  608. extern pascal CMError CWCheckColors(CMWorldRef cw, CMColor *myColors, unsigned long count, long *result)
  609.  FOURWORDINLINE(0x203C, 0x0010, 0x0003, 0x0ABEE);
  610. /* Bitmap matching */
  611. extern pascal CMError CWMatchBitmap(CMWorldRef cw, CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *matchedBitmap)
  612.  FOURWORDINLINE(0x203C, 0x0010, 0x002C, 0x0ABEE);
  613. extern pascal CMError CWCheckBitmap(CMWorldRef cw, const CMBitmap *bitmap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *resultBitmap)
  614.  FOURWORDINLINE(0x203C, 0x0014, 0x002D, 0x0ABEE);
  615. /* Quickdraw-specific matching */
  616. extern pascal CMError CWMatchPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon)
  617.  FOURWORDINLINE(0x203C, 0x0010, 0x0004, 0x0ABEE);
  618. extern pascal CMError CWCheckPixMap(CMWorldRef cw, PixMap *myPixMap, CMBitmapCallBackUPP progressProc, void *refCon, BitMap *resultBitMap)
  619.  FOURWORDINLINE(0x203C, 0x0014, 0x0007, 0x0ABEE);
  620. extern pascal CMError NCMBeginMatching(CMProfileRef src, CMProfileRef dst, CMMatchRef *myRef)
  621.  FOURWORDINLINE(0x203C, 0x000C, 0x0016, 0x0ABEE);
  622. extern pascal void CMEndMatching(CMMatchRef myRef)
  623.  FOURWORDINLINE(0x203C, 0x0004, 0x000B, 0x0ABEE);
  624. extern pascal void NCMDrawMatchedPicture(PicHandle myPicture, CMProfileRef dst, Rect *myRect)
  625.  FOURWORDINLINE(0x203C, 0x000C, 0x0017, 0x0ABEE);
  626. extern pascal void CMEnableMatchingComment(Boolean enableIt)
  627.  FOURWORDINLINE(0x203C, 0x0002, 0x000D, 0x0ABEE);
  628. extern pascal CMError NCMUseProfileComment(CMProfileRef prof, unsigned long flags)
  629.  FOURWORDINLINE(0x203C, 0x0008, 0x003B, 0x0ABEE);
  630. /* System Profile access */
  631. extern pascal CMError CMGetSystemProfile(CMProfileRef *prof)
  632.  FOURWORDINLINE(0x203C, 0x0004, 0x0018, 0x0ABEE);
  633. extern pascal CMError CMSetSystemProfile(const FSSpec *profileFileSpec)
  634.  FOURWORDINLINE(0x203C, 0x0004, 0x0019, 0x0ABEE);
  635. /* External Profile Management */
  636. extern pascal CMError CMNewProfileSearch(CMSearchRecord *searchSpec, void *refCon, unsigned long *count, CMProfileSearchRef *searchResult)
  637.  FOURWORDINLINE(0x203C, 0x0010, 0x0027, 0x0ABEE);
  638. extern pascal CMError CMUpdateProfileSearch(CMProfileSearchRef search, void *refCon, unsigned long *count)
  639.  FOURWORDINLINE(0x203C, 0x000C, 0x0028, 0x0ABEE);
  640. extern pascal void CMDisposeProfileSearch(CMProfileSearchRef search)
  641.  FOURWORDINLINE(0x203C, 0x0004, 0x0029, 0x0ABEE);
  642. extern pascal CMError CMSearchGetIndProfile(CMProfileSearchRef search, unsigned long index, CMProfileRef *prof)
  643.  FOURWORDINLINE(0x203C, 0x000C, 0x002A, 0x0ABEE);
  644. extern pascal CMError CMSearchGetIndProfileFileSpec(CMProfileSearchRef search, unsigned long index, FSSpec *profileFile)
  645.  FOURWORDINLINE(0x203C, 0x000C, 0x002B, 0x0ABEE);
  646. /* Utilities */
  647. extern pascal CMError CMGetColorSyncFolderSpec(short vRefNum, Boolean createFolder, short *foundVRefNum, long *foundDirID)
  648.  FOURWORDINLINE(0x203C, 0x000C, 0x0011, 0x0ABEE);
  649. extern pascal CMError CMGetCWInfo(CMWorldRef cw, CMCWInfoRecord *info)
  650.  FOURWORDINLINE(0x203C, 0x000C, 0x001A, 0x0ABEE);
  651. /* PS-related */
  652. extern pascal CMError CMGetPS2ColorSpace(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  653.  FOURWORDINLINE(0x203C, 0x0014, 0x002E, 0x0ABEE);
  654. extern pascal CMError CMGetPS2ColorRenderingIntent(CMProfileRef srcProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  655.  FOURWORDINLINE(0x203C, 0x0014, 0x002F, 0x0ABEE);
  656. extern pascal CMError CMGetPS2ColorRendering(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long flags, CMFlattenUPP proc, void *refCon, Boolean *preferredCMMnotfound)
  657.  FOURWORDINLINE(0x203C, 0x0018, 0x0030, 0x0ABEE);
  658. extern pascal CMError CMGetPS2ColorRenderingVMSize(CMProfileRef srcProf, CMProfileRef dstProf, unsigned long *vmSize, Boolean *preferredCMMnotfound)
  659.  FOURWORDINLINE(0x203C, 0x0010, 0x003D, 0x0ABEE);
  660. /* ColorSync 1.0 functions which have parallel 2.0 counterparts */
  661. extern pascal CMError CWNewColorWorld(CMWorldRef *cw, CMProfileHandle src, CMProfileHandle dst)
  662.  FOURWORDINLINE(0x203C, 0x000C, 0x0000, 0x0ABEE);
  663. extern pascal CMError ConcatenateProfiles(CMProfileHandle thru, CMProfileHandle dst, CMProfileHandle *newDst)
  664.  FOURWORDINLINE(0x203C, 0x000C, 0x000C, 0x0ABEE);
  665. extern pascal CMError CMBeginMatching(CMProfileHandle src, CMProfileHandle dst, CMMatchRef *myRef)
  666.  FOURWORDINLINE(0x203C, 0x000C, 0x000A, 0x0ABEE);
  667. extern pascal void CMDrawMatchedPicture(PicHandle myPicture, CMProfileHandle dst, Rect *myRect)
  668.  FOURWORDINLINE(0x203C, 0x000C, 0x0009, 0x0ABEE);
  669. extern pascal CMError CMUseProfileComment(CMProfileHandle profile)
  670.  FOURWORDINLINE(0x203C, 0x0004, 0x0008, 0x0ABEE);
  671. extern pascal void CMGetProfileName(CMProfileHandle myProfile, CMIString *IStringResult)
  672.  FOURWORDINLINE(0x203C, 0x0008, 0x000E, 0x0ABEE);
  673. extern pascal long CMGetProfileAdditionalDataOffset(CMProfileHandle myProfile)
  674.  FOURWORDINLINE(0x203C, 0x0004, 0x000F, 0x0ABEE);
  675. /* ProfileResponder functions */
  676. extern pascal CMError GetProfile(OSType deviceType, long refNum, CMProfileHandle aProfile, CMProfileHandle *returnedProfile)
  677.  FOURWORDINLINE(0x203C, 0x0010, 0x0005, 0x0ABEE);
  678. extern pascal CMError SetProfile(OSType deviceType, long refNum, CMProfileHandle newProfile)
  679.  FOURWORDINLINE(0x203C, 0x000C, 0x0006, 0x0ABEE);
  680. extern pascal CMError SetProfileDescription(OSType deviceType, long refNum, long deviceData, CMProfileHandle hProfile)
  681.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0x0ABEE);
  682. extern pascal CMError GetIndexedProfile(OSType deviceType, long refNum, CMProfileSearchRecordHandle search, CMProfileHandle *returnProfile, long *index)
  683.  FOURWORDINLINE(0x203C, 0x0014, 0x0012, 0x0ABEE);
  684. extern pascal CMError DeleteDeviceProfile(OSType deviceType, long refNum, CMProfileHandle deleteMe)
  685.  FOURWORDINLINE(0x203C, 0x000C, 0x0013, 0x0ABEE);
  686. #if OLDROUTINENAMES
  687. typedef CMFlattenProcPtr CMFlattenProc;
  688.  
  689. typedef CMBitmapCallBackProcPtr CMBitmapCallBackProc;
  690.  
  691. typedef CMProfileFilterProcPtr CMProfileFilterProc;
  692.  
  693.  
  694. enum {
  695.     CMTrap                        = cmTrap,
  696.     CMBeginProfile                = cmBeginProfile,
  697.     CMEndProfile                = cmEndProfile,
  698.     CMEnableMatching            = cmEnableMatching,
  699.     CMDisableMatching            = cmDisableMatching
  700. };
  701.  
  702. /* 1.0 Error codes, for compatibility with older applications. 1.0 CMM's may return obsolete error codes */
  703. enum {
  704.     CMNoError                    = 0,                            /*    obsolete name, use noErr */
  705.     CMProfileError                = cmProfileError,
  706.     CMMethodError                = cmMethodError,
  707.     CMMemFullError                = -172,                            /*    obsolete, 2.0 uses memFullErr */
  708.     CMUnimplementedError        = -173,                            /*    obsolete, 2.0 uses unimpErr */
  709.     CMParamError                = -174,                            /*    obsolete, 2.0 uses paramErr */
  710.     CMMethodNotFound            = cmMethodNotFound,
  711.     CMProfileNotFound            = cmProfileNotFound,
  712.     CMProfilesIdentical            = cmProfilesIdentical,
  713.     CMCantConcatenateError        = cmCantConcatenateError,
  714.     CMCantXYZ                    = cmCantXYZ,
  715.     CMCantDeleteProfile            = cmCantDeleteProfile,
  716.     CMUnsupportedDataType        = cmUnsupportedDataType,
  717.     CMNoCurrentProfile            = cmNoCurrentProfile
  718. };
  719.  
  720. enum {
  721.     qdSystemDevice                = cmSystemDevice,
  722.     qdGDevice                    = cmGDevice
  723. };
  724.  
  725. enum {
  726.     kMatchCMMType                = cmMatchCMMType,
  727.     kMatchApplProfileVersion    = cmMatchApplProfileVersion,
  728.     kMatchDataType                = cmMatchDataType,
  729.     kMatchDeviceType            = cmMatchDeviceType,
  730.     kMatchDeviceManufacturer    = cmMatchDeviceManufacturer,
  731.     kMatchDeviceModel            = cmMatchDeviceModel,
  732.     kMatchDeviceAttributes        = cmMatchDeviceAttributes,
  733.     kMatchFlags                    = cmMatchFlags,
  734.     kMatchOptions                = cmMatchOptions,
  735.     kMatchWhite                    = cmMatchWhite,
  736.     kMatchBlack                    = cmMatchBlack
  737. };
  738.  
  739. /* types */
  740. typedef struct CMCMYKColor CMYKColor;
  741.  
  742. typedef CMWorldRef CWorld;
  743.  
  744. typedef long *CMGamutResult;
  745.  
  746. /* functions */
  747. #define EndMatching(myRef) CMEndMatching(myRef)
  748. #define EnableMatching(enableIt) CMEnableMatchingComment(enableIt)
  749. #define GetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID) CMGetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)
  750. #define BeginMatching(src, dst, myRef) CMBeginMatching(src, dst, myRef)
  751. #define DrawMatchedPicture(myPicture, dst, myRect) CMDrawMatchedPicture(myPicture, dst, myRect)
  752. #define UseProfile(profile) CMUseProfileComment(profile)
  753. #define GetProfileName(myProfile, IStringResult) CMGetProfileName(myProfile, IStringResult)
  754. #define GetProfileAdditionalDataOffset(myProfile) CMGetProfileAdditionalDataOffset(myProfile)
  755. #endif
  756.  
  757. #ifdef __CFM68K__
  758. #pragma import off
  759. #endif
  760.  
  761. #if GENERATINGPOWERPC
  762. #pragma options align=reset
  763. #endif
  764.  
  765. #ifdef __cplusplus
  766. }
  767. #endif
  768.  
  769. #endif /* __CMAPPLICATION__ */
  770.